package com.ims.core.doc.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ims.common.annotation.Log;
import com.ims.common.core.controller.BaseController;
import com.ims.common.core.domain.AjaxResult;
import com.ims.common.enums.BusinessType;
import com.ims.core.doc.domain.TInNon1004;
import com.ims.core.doc.service.ITInNon1004Service;
import com.ims.common.utils.poi.ExcelUtil;
import com.ims.common.core.page.TableDataInfo;

/**
 * 出租车Controller
 *
 * @author IMS
 * @date 2024-11-20
 */
@RestController
@RequestMapping("/doc/chuzhuche")
public class TInNon1004Controller extends BaseController
{
    @Autowired
    private ITInNon1004Service tInNon1004Service;

    /**
     * 查询出租车列表
     */
    @PreAuthorize("@ss.hasPermi('doc:chuzhuche:list')")
    @GetMapping("/list")
    public TableDataInfo list(TInNon1004 tInNon1004)
    {
        startPage();
        List<TInNon1004> list = tInNon1004Service.selectTInNon1004List(tInNon1004);
        return getDataTable(list);
    }

    /**
     * 导出出租车列表
     */
    @PreAuthorize("@ss.hasPermi('doc:chuzhuche:export')")
    @Log(title = "出租车", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, TInNon1004 tInNon1004)
    {
        List<TInNon1004> list = tInNon1004Service.selectTInNon1004List(tInNon1004);
        ExcelUtil<TInNon1004> util = new ExcelUtil<TInNon1004>(TInNon1004.class);
        util.exportExcel(response, list, "出租车数据");
    }

    /**
     * 获取出租车详细信息
     */
    @PreAuthorize("@ss.hasPermi('doc:chuzhuche:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return success(tInNon1004Service.selectTInNon1004ById(id));
    }

    /**
     * 新增出租车
     */
    @PreAuthorize("@ss.hasPermi('doc:chuzhuche:add')")
    @Log(title = "出租车", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody TInNon1004 tInNon1004)
    {
        return toAjax(tInNon1004Service.insertTInNon1004(tInNon1004));
    }

    /**
     * 修改出租车
     */
    @PreAuthorize("@ss.hasPermi('doc:chuzhuche:edit')")
    @Log(title = "出租车", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody TInNon1004 tInNon1004)
    {
        return toAjax(tInNon1004Service.updateTInNon1004(tInNon1004));
    }

    /**
     * 删除出租车
     */
    @PreAuthorize("@ss.hasPermi('doc:chuzhuche:remove')")
    @Log(title = "出租车", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(tInNon1004Service.deleteTInNon1004ByIds(ids));
    }
}
